home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_2 / star-1_0.tar / table.c < prev   
C/C++ Source or Header  |  1991-03-22  |  5KB  |  150 lines

  1. /* table.c -- STAR Function Table
  2.  
  3. This file is part of STAR, the Saturn Macro Assembler.
  4.  
  5.    STAR is not distributed by the Free Software Foundation. Do not ask
  6. them for a copy or how to obtain new releases. Instead, send e-mail to
  7. the address below. STAR is merely covered by the GNU General Public
  8. License.
  9.  
  10. Please send your comments, ideas, and bug reports to
  11. Jan Brittenson <bson@ai.mit.edu>
  12.  
  13. */
  14.  
  15.  
  16. /* Copyright (C) 1990, 1991 Jan Brittenson.
  17.  
  18.    STAR is free software; you can redistribute it and/or modify it
  19. under the terms of the GNU General Public License as published by the
  20. Free Software Foundation; either version 1, or (at your option) any
  21. later version.
  22.  
  23.    STAR is distributed in the hope that it will be useful, but WITHOUT
  24. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  25. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  26. for more details.
  27.  
  28.    You should have received a copy of the GNU General Public License
  29. along with STAR; see the file COPYING. If not, to obtain a copy, write
  30. to the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139,
  31. USA, or send e-mail to bson@ai.mit.edu. */
  32.  
  33. #include <stdio.h>
  34. #include "star.h"
  35.  
  36.  
  37. /* Functions referenced in the function table */
  38. extern struct val
  39.   evbne(), evbnot(), evlnot(), evrshf(), evlshf(), evble(), evbge(),
  40.   evblt(), evbgt(), evbeq(), evbor(), evband(), evlor(), evland(),
  41.   evbxor(), evlxor(), evadd(), evsub(), evdiv(), evmul(), evmod(),
  42.   evbits(), evoct(), evdec(), evhex(), evneg(), evbin(), evleft(),
  43.   evdefd(), evloc0(), evpass(), evinstances(), evstr(), evleftstr(),
  44.   evrightstr(), evchartostr(), evstrlen(), evtrimld(), evtrimtr(),
  45.   eveval(), evinstr(), evgensym(), evtype(), evuc(), evreal(),
  46.   evpow(), evfun(), evinstrlen(), evrmask(), evrtobin(), evlocal(),
  47.   evliteral(), evused(), evkcrc();
  48.  
  49. /* Function table
  50.  *
  51.  *    Function    Type    Evaluator
  52.  */
  53. struct fstruct
  54.   funtbl[] =    {
  55.     {"`",    OPX+F_FAST, evstr, 0},
  56.     {"!=",    XOPY,    evbne, 0},
  57.     {"!",    OPX,    evbnot, 0},
  58.     {"~",    OPX,    evlnot, 0},
  59.     {">>",    XOPY,    evrshf, 0},
  60.     {"<<",    XOPY,    evlshf, 0},
  61.     {"<=",    XOPY,    evble, 0},
  62.     {">=",    XOPY,    evbge, 0},
  63.     {"<",    XOPY,    evblt, 0},
  64.     {">",    XOPY,    evbgt, 0},
  65.     {"==",    XOPY,    evbeq, 0},
  66.     {"||",    XOPY,    evbor, 0},
  67.     {"&&",    XOPY,    evband, 0},
  68.     {"|",    XOPY,    evlor, 0},
  69.     {"&",    XOPY,    evland, 0},
  70.     {"^^",    XOPY,    evbxor, 0},
  71.     {"^",    XOPY,    evlxor, 0},
  72.     {"+",    XOPY,    evadd, 0},
  73.     {"-",    XOPY,    evsub, 0},
  74.     {"-",    OPX,    evneg, 0},
  75.     {"/",    XOPY,    evdiv, 0},
  76.     {"**",    XOPY,    evpow, 0},
  77.     {"*",    XOPY,    evmul, 0},
  78.     {"%",    XOPY,    evmod, 0},
  79.     {"$",    OPX+F_FAST,    evlocal, 0},
  80.     {".",    OPX+F_FAST,    evloc0, 0},
  81.     {"[",    OPX+F_FAST,    evbits, 0},
  82.     {"(",    OPX+F_FAST,    evleft, 0},
  83.     {"^R",    OPX+F_FAST,    evreal, 0},
  84.     {"R'",    OPX+F_FAST,    evreal, 0},
  85.     {"^B",    OPX+F_FAST,    evbin, 0},
  86.     {"B'",    OPX+F_FAST,    evbin, 0},
  87.     {"2'",    OPX+F_FAST,    evbin, 0},
  88.     {"^O",    OPX+F_FAST,    evoct, 0},
  89.     {"O'",    OPX+F_FAST,    evoct, 0},
  90.     {"8'",    OPX+F_FAST,    evoct, 0},
  91.     {"^D",    OPX+F_FAST,    evdec, 0},
  92.     {"D'",    OPX+F_FAST,    evdec, 0},
  93.     {"10'",    OPX+F_FAST,    evdec, 0},
  94.     {"^X",    OPX+F_FAST,    evhex, 0},
  95.     {"0X",    OPX+F_FAST,    evhex, 0},
  96.     {"0",    OPX+F_FAST,    evoct, 1},
  97.     {"X'",    OPX+F_FAST,    evhex, 0},
  98.     {"#",    OPX+F_FAST,    evhex, 0},
  99.     {"16'",    OPX+F_FAST,    evhex, 0},
  100.     {"WD^",    OPX,        evrtobin, 0},
  101.     {"WD%",    OPX,        evrtobin, 0},
  102.     {"DF",    OPX+F_FAST,    evdefd, 0},
  103.     {"DEF",    OPX+F_FAST,    evdefd, 0},
  104.     {"PASS",    OPX+F_FAST,    evpass, 0},
  105.     {"KCRC",    OPX+F_FAST,    evkcrc, 0},
  106.     {"INSTANCES", OPX+F_FAST,    evinstances, 0},
  107.     {"GENSYM",  OPX+F_FAST,    evgensym, 0},
  108.     {"L%",    XOPY,        evleftstr, 0},
  109.     {"R%",     XOPY,        evrightstr, 0},
  110.     {"C^",    OPX,        evchartostr, 0},
  111.     {"CH%",    OPX,        evchartostr, 0},
  112.     {"CH^",    OPX,        evchartostr, 0},
  113.     {"SZ%",    OPX,        evstrlen, 0},
  114.     {"SZ^",    OPX,        evstrlen, 0},
  115.     {"TL^",    OPX,        evtrimld, 0},
  116.     {"TL%",    OPX,        evtrimld, 0},
  117.     {"TT^",    OPX,        evtrimtr, 0},
  118.     {"TT%",    OPX,        evtrimtr, 0},
  119.     {"EV^",    OPX,        eveval, 0},
  120.     {"EV%",    OPX,        eveval, 0},
  121.     {"UC^",    OPX,        evuc, 0},
  122.     {"UC%",    OPX,        evuc, 0},
  123.     {"I^",    OPX,        evinstr, 0},
  124.     {"I%",    OPX,        evinstr, 0},
  125.     {"NI^",    OPX,        evinstrlen, 0},
  126.     {"NI%",    OPX,        evinstrlen, 0},
  127.     {"M^",    OPX,        evrmask, 0},
  128.     {"'",    OPX,        evliteral, 0},
  129.     {"USED",    OPX+F_FAST,    evused, 0},
  130.     {"TYPEOF",    OPX,        evtype, 0},
  131.     {"ACOS",     OPX,         evfun, DF_ACOS},
  132.     {"ASIN",     OPX,         evfun, DF_ASIN},
  133.     {"ATAN",     OPX,         evfun, DF_ATAN},
  134.     {"CEIL",     OPX,         evfun, DF_CEIL},
  135.     {"COSH",     OPX,         evfun, DF_COSH},
  136.     {"COS",     OPX,         evfun, DF_COS},
  137.     {"EXP",     OPX,         evfun, DF_EXP},
  138.     {"FABS",     OPX,         evfun, DF_FABS},
  139.     {"FLOOR",     OPX,         evfun, DF_FLOOR},
  140.     {"FMOD",     OPX,         evfun, DF_FMOD},
  141.     {"LOG10",     OPX,         evfun, DF_LOG10},
  142.     {"LOG",     OPX,         evfun, DF_LOG},
  143.     {"SINH",     OPX,         evfun, DF_SINH},
  144.     {"SIN",     OPX,         evfun, DF_SIN},
  145.     {"SQRT",     OPX,         evfun, DF_SQRT},
  146.     {"TANH",     OPX,         evfun, DF_TANH},
  147.     {"TAN",     OPX,         evfun, DF_TAN},
  148.     {NULL,    OPX+F_FAST,    evhex}
  149.   };
  150.